import requests
import json
import codecs
import datetime
#file = codecs.open('movie.json', 'w',encoding='utf-8')
#API
url = 'https://douban.uieee.com/v2/book/isbn/9787508695792'
# 参数列表
start=0
count=0
r = requests.get(url, params={'start': start, 'count': count})
r.encoding='UTF_8'
content=r.json()
res=dict(content)
database={}
# for i,k in res.items():
#     print(i,k)

database['id']='null'
database['title']=res['title']
database['author']=res['author']
database['price']=res['price']
database['publisher']=res['publisher']
database['isbn13']=res['isbn13']
database['summary']=res['summary']
database['catalog']=res['catalog']
database['pubdate']=res['pubdate']
database['author_intro']=res['author_intro']
database['status']=0
database['num']=1
database['addtime']=datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
database['author']=res['images']['small']
for i,k in database.items():
    print(i,k)
#file.write(json.dumps(content,ensure_ascii=False))
